package com.topscomm.pm.script;

import com.topscomm.cbo.pojo.CboApprovalNodeInsEntity;
import com.topscomm.pm.PmScript;
import com.topscomm.pm.service.impl.PmContractService;
import com.topscomm.pub.util.ConvertUtil;
import com.topscomm.pub.util.SpringUtil;
import com.topscomm.tap.ITapService;
import com.topscomm.tap.TapEntity;

public class PmContractScript extends PmScript {
    /**
     * @author: wushenghong
     * @date: 2020/6/4
     * @description: 项目合同金额更新
     */
    public void updateContractMoneyToProject(ITapService service, TapEntity entity) throws Exception {
        // 审批节点实例
        CboApprovalNodeInsEntity nodeIns = (CboApprovalNodeInsEntity) entity;
        String sourceId = ConvertUtil.convertToString(nodeIns.getSourceid());
        PmContractService pmContractService = (PmContractService) SpringUtil.getBean("pmContractService");
        pmContractService.updateContractMoneyOfProjectBaseForApproval(sourceId, true);
    }
    /**
     * @description: 扫描件审批通过之后 对scannedCopyApprovalTime字段赋值
     * @author: duzehou
     * @date: 2022/11/9 9:23
     * @param: [service, entity]
     * @return: void
     **/
    public void scannedCopyApprovalTime(ITapService service, TapEntity entity) throws Exception {
        // 审批节点实例
        CboApprovalNodeInsEntity nodeIns = (CboApprovalNodeInsEntity) entity;
        String sourceId = ConvertUtil.convertToString(nodeIns.getSourceid());
        PmContractService pmContractService = (PmContractService) SpringUtil.getBean("pmContractService");
        pmContractService.scannedCopyApprovalTime(sourceId, true);
    }
}
